//
//  LoginViewController.m
//  GLGW_Shoping
//
//  Created by yang on 2018/11/15.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "LoginViewController.h"
#import "LoginViewModel.h"
#import "RegistereViewController.h"

@interface LoginViewController ()<loginViewModelDelegate>
@property (nonatomic,strong) LoginViewModel * loginViewModel;
@end

@implementation LoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.loginViewModel = [[LoginViewModel alloc] initWithViewToViewModel:self.tableView theSuperView:self.view];
    [self addNavigationItemWithTitles:@[@"注册"] isLeft:NO target:self action:@selector(registereAction) tags:@[@33] theButTitColor:kColor_Rule_Yellow titFont:SYSTEMFONT(15)];
    self.loginViewModel.delegate = self;
    // Do any additional setup after loading the view.
}

-(void)registereAction{
    RegistereViewController * regisesVC = [RegistereViewController new];
    regisesVC.reg_type = RegisterePushType_Registere;
    [self.navigationController pushViewController:regisesVC animated:YES];
}

#pragma mark --loginViewModelDelegate
- (void)loginSuccess{
    [self.navigationController popToRootViewControllerAnimated:YES];
}

-(void)loginFootViewButAction:(GLGWButton *)b_but{
    RegistereViewController * regisesVC = [RegistereViewController new];
    regisesVC.reg_type = RegisterePushType_RetrievePassword;
    [self.navigationController pushViewController:regisesVC animated:YES];
}

-(void)bindingIdentityType:(NSInteger)b_type theToken:(NSString *)token theOpenId:(NSString *)openId{
    NSMutableDictionary * dic = [NSMutableDictionary dictionaryWithDictionary:@{@"openId":openId,@"identityType":@(b_type),@"token":token}];
    RegistereViewController * regisesVC = [RegistereViewController new];
    regisesVC.reg_type = RegisterePushType_BindingPhone;
    regisesVC.dic_OpenInfor = dic;
    [self.navigationController pushViewController:regisesVC animated:YES];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
